package com.grocery.service.impl;

import com.grocery.bean.Product;
import com.grocery.dao.ProductDao;
import com.grocery.service.IProductService;
import com.grocery.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ProductService implements IProductService {
    @Autowired
    ProductDao productDao;

    @Override
    public int add(Product product) {
        return productDao.add(product);
    }

    @Override
    public int delete(int id) {
        return productDao.delete(id);
    }

    @Override
    public int edit(Product product) {
        return productDao.edit(product);
    }

    @Override
    public Product getByID(int id) {
        return productDao.getByID(id);
    }

    @Override
    public List<Product> getList(Page page, String text) {
        return productDao.getList(page, text);
    }

    @Override
    public List<Product> getByState(int state) {
        return productDao.getByState(state);
    }

    @Override
    public List<Product> getAllList() {
        return productDao.getAllList();
    }

    @Override
    public List<Product> getAllListbypid(Integer pid) {
        return productDao.getallListbypid(pid);
    }

    @Override
    public int getCount(String text) {
        return productDao.getCount(text);
    }
}
